<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>淘宝搜索</title>
		<script>
			function choose() {
				var ele = document.getElementsByName("search");
				var searchform = document.getElementById("searchform");
				var inText = searchform.firstElementChild;
				var logo = document.getElementById("logo");
				if(ele[0].checked) {
					logo.src = "img/baidu_web.png";
					searchform.action = "https://www.baidu.com/s";
					inText.name="word";
				} else if(ele[1].checked) {
					logo.src = "img/google_web.png";
					searchform.action = "https://www.google.com.hk/search";inText.name= "q";
				} else if(ele[2].checked) {
					logo.src = "img/taobao_shopping.png";
					searchform.action = "https://s.taobao.com/search";
					inText.name= "q";
				}
			}
		</script>
	</head>

	<body>
		<div style="text-align: center;">
			<img src="img/baidu_web.png" id="logo" />
			<form action="https://www.baidu.com/s" id="searchform" method="get" style="display: inline;">
				<input type="text" name="word" />
				<input type="submit" value="搜索" />
			</form>
			<br />
			<input type="radio" name="search" onclick="choose()" checked="checked" />百度
			<input type="radio" name="search" onclick="choose()" />谷歌
			<input type="radio" name="search" onclick="choose()" />淘宝
		</div>
	</body>

</html>